home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / powerd / lib / powerd.lha / powerd_ppc / BitCount.ass < prev    next >
Encoding:
Text File  |  1980-11-16  |  268 b   |  23 lines

  1.  
  2. # BitCount(r3:LONG)(LONG)
  3.  
  4.     .text
  5.     .global    _BitCount
  6.  
  7. _BitCount:
  8.     li    r4,31
  9.     li    r6,0
  10. .loop:    li    r5,1
  11.     slw    r5,r5,r4
  12.     and.    r0,r3,r5
  13.     beq    .next
  14.     addi    r6,r6,1
  15. .next:    subi    r4,r4,1
  16.     mr.    r4,r4
  17.     bge    .loop
  18.     mr    r3,r6
  19.     blr
  20.  
  21.     .type    _BitCount,@function
  22.     .size    _BitCount,$-_BitCount
  23.